object VelForm: TVelForm
  Left = 0
  Top = 0
  BorderStyle = bsDialog
  Caption = #1056#1086#1079#1088#1072#1093#1091#1085#1086#1082' '#1089#1077#1088#1077#1076#1085#1110#1093' '#1084#1072#1088#1096#1088#1091#1090#1085#1080#1093' '#1096#1074#1080#1076#1082#1086#1089#1090#1077#1081': '
  ClientHeight = 455
  ClientWidth = 442
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  Position = poOwnerFormCenter
  OnClose = FormClose
  OnCreate = FormCreate
  PixelsPerInch = 96
  TextHeight = 13
  object Label1: TLabel
    Left = 24
    Top = 21
    Width = 243
    Height = 13
    Caption = #1064#1083#1103#1093' '#1076#1086' '#1092#1072#1081#1083#1091' '#1079' '#1076#1072#1085#1080#1084#1080' '#1087#1088#1086' '#1087#1086#1111#1079#1076#1080' (trains.txt):'
  end
  object Label2: TLabel
    Left = 24
    Top = 73
    Width = 242
    Height = 13
    Caption = #1064#1083#1103#1093' '#1076#1086' '#1092#1072#1081#1083#1091' '#1079' '#1076#1072#1085#1080#1084#1080' '#1087#1088#1086' '#1084#1072#1088#1096#1088#1091#1090#1080' (tr.txt):'
  end
  object Label3: TLabel
    Left = 24
    Top = 161
    Width = 211
    Height = 13
    Caption = #1056#1077#1079#1091#1083#1100#1090#1072#1090' '#1088#1086#1079#1088#1072#1093#1091#1085#1082#1091' '#1096#1074#1080#1076#1082#1086#1089#1090#1077#1081':'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -11
    Font.Name = 'Tahoma'
    Font.Style = [fsBold]
    ParentFont = False
  end
  object Label4: TLabel
    Left = 24
    Top = 2
    Width = 228
    Height = 13
    Caption = #1054#1085#1086#1074#1083#1077#1085#1085#1103' '#1076#1072#1085#1080#1093' '#1087#1088#1086' '#1088#1086#1079#1082#1083#1072#1076' '#1087#1086#1111#1079#1076#1110#1074':'
    Font.Charset = DEFAULT_CHARSET
    Font.Color = clWindowText
    Font.Height = -11
    Font.Name = 'Tahoma'
    Font.Style = [fsBold]
    ParentFont = False
  end
  object StatusLabel: TLabel
    Left = 178
    Top = 132
    Width = 3
    Height = 13
  end
  object Button1: TButton
    Left = 393
    Top = 92
    Width = 27
    Height = 22
    Caption = '...'
    TabOrder = 2
    OnClick = Button1Click
  end
  object Button2: TButton
    Left = 24
    Top = 130
    Width = 148
    Height = 25
    Caption = '1. '#1047#1072#1074#1072#1085#1090#1072#1078#1080#1090#1080' '#1076#1072#1085#1110
    TabOrder = 4
    OnClick = Button2Click
  end
  object Button3: TButton
    Left = 24
    Top = 420
    Width = 141
    Height = 25
    Caption = '2. '#1056#1086#1079#1088#1072#1093#1091#1074#1072#1090#1080' '#1096#1074#1080#1076#1082#1086#1089#1090#1110
    TabOrder = 5
    OnClick = Button3Click
  end
  object Edit2: TEdit
    Left = 24
    Top = 40
    Width = 369
    Height = 21
    TabOrder = 1
  end
  object DBGrid1: TDBGrid
    Left = 24
    Top = 180
    Width = 396
    Height = 234
    DataSource = DataSource1
    TabOrder = 6
    TitleFont.Charset = DEFAULT_CHARSET
    TitleFont.Color = clWindowText
    TitleFont.Height = -11
    TitleFont.Name = 'Tahoma'
    TitleFont.Style = []
    Columns = <
      item
        Expanded = False
        FieldName = 'F_1'
        Width = 239
        Visible = True
      end
      item
        Expanded = False
        FieldName = 'VELO'
        Visible = True
      end>
  end
  object LoadButton2: TButton
    Left = 345
    Top = 127
    Width = 75
    Height = 25
    Caption = 'load 2'
    TabOrder = 7
    Visible = False
    OnClick = LoadButton2Click
  end
  object Edit1: TEdit
    Left = 24
    Top = 92
    Width = 369
    Height = 21
    TabOrder = 3
  end
  object Button5: TButton
    Left = 393
    Top = 40
    Width = 27
    Height = 22
    Caption = '...'
    TabOrder = 0
    OnClick = Button5Click
  end
  object BitBtn1: TBitBtn
    Left = 332
    Top = 420
    Width = 88
    Height = 25
    TabOrder = 8
    Kind = bkOK
  end
  object OpenDialog1: TOpenDialog
    Left = 340
    Top = 4
  end
  object IBTransaction1: TIBTransaction
    DefaultDatabase = IBDatabase
    Left = 340
    Top = 68
  end
  object InsertIBQuery: TIBQuery
    Database = IBDatabase
    Transaction = IBTransaction1
    SQL.Strings = (
      'insert into  TRAINTRACE (N_ST, NP, PR, ST,OTPR)'
      'values(:N_ST, :NP, :PR, :ST, :OTPR)')
    Left = 276
    Top = 4
    ParamData = <
      item
        DataType = ftInteger
        Name = 'N_ST'
        ParamType = ptInput
      end
      item
        DataType = ftInteger
        Name = 'NP'
        ParamType = ptInput
      end
      item
        DataType = ftString
        Name = 'PR'
        ParamType = ptInput
      end
      item
        DataType = ftInteger
        Name = 'ST'
        ParamType = ptInput
      end
      item
        DataType = ftUnknown
        Name = 'OTPR'
        ParamType = ptUnknown
      end>
  end
  object SelectIBQuery: TIBQuery
    Database = IBDatabase
    Transaction = IBTransaction1
    SQL.Strings = (
      
        '      select  '#39#1057#1077#1088#1077#1076#1085#1103' '#1096#1074#1080#1076#1082#1110#1089#1090#1100' '#1087#1072#1089#1089#1072#1078#1080#1088#1089#1100#1082#1080#1093#39' , avg(3600.0*d.d' +
        'ist/trA.t_way) velo'
      '      from ('
      
        '      select atr.np, sum(fromcode) fromcode, sum(tocode) tocode ' +
        ', atr.t_way'
      '      from ('
      
        '            select t.np np,  0 fromcode , s.code_es6 tocode, t.t' +
        '_way'
      
        '            from trains t inner join  (stations s  join traintra' +
        'ce tr on s.code_5 = tr.st) on  t.np=tr.np'
      
        '           where t.n_t between 301 and 398 or (t.n_t between 401' +
        ' and 498) or (t.n_t between 501 and 598) or (t.n_t between 601 a' +
        'nd 698)  and tr.pr = '#39'2'#39
      '      union'
      
        '            select t.np np, s.code_es6 fromcode , 0 tocode, t.t_' +
        'way'
      
        '            from trains t inner join  (stations s  join traintra' +
        'ce tr on s.code_5 = tr.st) on  t.np=tr.np'
      
        '            where t.n_t between 301 and 398 or (t.n_t between 40' +
        '1 and 498) or (t.n_t between 501 and 598) or (t.n_t between 601 ' +
        'and 698)  and tr.pr = '#39'1'#39
      '      ) atr'
      '      group by atr.np, atr.t_way ) trA, distans d'
      '      where d.fromcode = trA.fromcode and d.tocode=trA.tocode'
      '      union'
      '         --Release  '#1096#1074#1080#1076#1082#1099#1089#1085#1080'  81,3'
      
        '      select  '#39#1057#1077#1088#1077#1076#1085#1103' '#1096#1074#1080#1076#1082#1110#1089#1090#1100' '#1096#1074#1080#1076#1082#1080#1089#1085#1080#1093#39', avg(3600.0*d.dist/' +
        'trA.t_way)'
      '      from ('
      
        '      select atr.np, sum(fromcode) fromcode, sum(tocode) tocode ' +
        ', atr.t_way'
      '      from ('
      
        '            select t.np np, 0 fromcode , s.code_es6 tocode, t.t_' +
        'way'
      
        '            from trains t inner join  (stations s  join traintra' +
        'ce tr on s.code_5 = tr.st) on  t.np=tr.np'
      '           where t.n_t between 151 and 168 and tr.pr = '#39'2'#39
      '      union'
      
        '            select t.np np, s.code_es6 fromcode , 0 tocode, t.t_' +
        'way'
      
        '            from trains t inner join  (stations s  join traintra' +
        'ce tr on s.code_5 = tr.st) on  t.np=tr.np'
      '            where t.n_t between 151 and 168 and tr.pr = '#39'1'#39
      '      ) atr'
      '      group by atr.np, atr.t_way ) trA, distans d'
      '      where d.fromcode = trA.fromcode and d.tocode=trA.tocode'
      '      union'
      '      --Release  '#1087#1088#1080#1089#1082#1086#1088#1077#1085#1080' 67,5'
      
        '      select  '#39#1057#1077#1088#1077#1076#1085#1103' '#1096#1074#1080#1076#1082#1110#1089#1090#1100' '#1087#1088#1080#1089#1082#1086#1088#1077#1085#1080#1093#39', avg(3600.0*d.dist' +
        '/trA.t_way)'
      '      from ('
      
        '      select atr.np, sum(fromcode) fromcode, sum(tocode) tocode ' +
        ', atr.t_way'
      '      from ('
      
        '            select t.np np,  0 fromcode , s.code_es6 tocode, t.t' +
        '_way'
      
        '            from trains t inner join  (stations s  join traintra' +
        'ce tr on s.code_5 = tr.st) on  t.np=tr.np'
      '           where t.n_t between 171 and 198  and tr.pr = '#39'2'#39
      '      union'
      
        '            select t.np np, s.code_es6 fromcode , 0 tocode, t.t_' +
        'way'
      
        '            from trains t inner join  (stations s  join traintra' +
        'ce tr on s.code_5 = tr.st) on  t.np=tr.np'
      '            where t.n_t between 171 and 198  and tr.pr = '#39'1'#39
      '      ) atr'
      '      group by atr.np, atr.t_way ) trA, distans d'
      '      where d.fromcode = trA.fromcode and d.tocode=trA.tocode'
      '      union'
      
        '      select  '#39#1057#1077#1088#1077#1076#1085#1103' '#1096#1074#1080#1076#1082#1110#1089#1090#1100' '#1096#1074#1080#1076#1082#1080#1093#39', avg(3600.0*d.dist/trA' +
        '.t_way)'
      '      from ('
      
        '      select atr.np, sum(fromcode) fromcode, sum(tocode) tocode ' +
        ', atr.t_way'
      '      from ('
      
        '            select t.np np,  0 fromcode , s.code_es6 tocode, t.t' +
        '_way'
      
        '            from trains t inner join  (stations s  join traintra' +
        'ce tr on s.code_5 = tr.st) on  t.np=tr.np'
      
        '            where t.n_t between 1 and 148 or (t.n_t between 201 ' +
        'and 298)  and tr.pr = '#39'2'#39
      '      union'
      
        '            select t.np np, s.code_es6 fromcode , 0 tocode, t.t_' +
        'way'
      
        '            from trains t inner join  (stations s  join traintra' +
        'ce tr on s.code_5 = tr.st) on  t.np=tr.np'
      
        '             where t.n_t between 1 and 148 or (t.n_t between 201' +
        ' and 298)  and tr.pr = '#39'1'#39
      '      ) atr'
      '      group by atr.np, atr.t_way ) trA, distans d'
      '      where d.fromcode = trA.fromcode and d.tocode=trA.tocode'
      '     order by 2'
      ''
      ''
      '')
    Left = 276
    Top = 100
    object SelectIBQueryF_1: TIBStringField
      DisplayLabel = #1042#1080#1076
      DisplayWidth = 35
      FieldName = 'F_1'
      ProviderFlags = []
      FixedChar = True
      Size = 31
    end
    object SelectIBQueryVELO: TIBBCDField
      DisplayLabel = #1064#1074#1080#1076#1082#1110#1089#1090#1100
      FieldName = 'VELO'
      ProviderFlags = []
      Precision = 18
      Size = 1
    end
  end
  object IBDatabase: TIBDatabase
    DatabaseName = 'D:\home\iv\real\Buro\'#1040#1056#1052' '#1058#1072#1088#1080#1092#1099'\ticketuzdiit\BD\LENS.FDB'
    Params.Strings = (
      'user_name=sysdba'
      'password=masterkey')
    LoginPrompt = False
    DefaultTransaction = IBTransaction1
    AllowStreamedConnected = False
    Left = 340
    Top = 36
  end
  object DataSource1: TDataSource
    DataSet = SelectIBQuery
    Left = 276
    Top = 68
  end
  object IBQueryInsertTrans: TIBQuery
    Database = IBDatabase
    Transaction = IBTransaction1
    SQL.Strings = (
      'insert into  TRAINS (N_T,N_E, NP, t_way)'
      'values(:N_T,:N_E, :NP, :t_way)')
    Left = 276
    Top = 36
    ParamData = <
      item
        DataType = ftUnknown
        Name = 'N_T'
        ParamType = ptUnknown
      end
      item
        DataType = ftUnknown
        Name = 'N_E'
        ParamType = ptUnknown
      end
      item
        DataType = ftInteger
        Name = 'NP'
        ParamType = ptInput
      end
      item
        DataType = ftUnknown
        Name = 't_way'
        ParamType = ptUnknown
      end>
  end
  object ClearIBQuery: TIBQuery
    Database = IBDatabase
    Transaction = IBTransaction1
    Left = 392
    Top = 4
  end
end
